<?php
@session_start();
@$userName=$_REQUEST['userName'];
@$passWord=$_REQUEST['passWord'];

$msg=null;
if(!empty($userName)&&!empty($passWord)){
	$pdo=new PDO('mysql:dbname=BB;charset=utf8','root');
	$sel=$pdo->prepare('select * from user where username=:login');
	$isok=$sel->execute(array('login'=>$userName));
	if($isok){
		$user=$sel->fetch(PDO::FETCH_NAMED);
		if(empty($user)){
			$msg="未找到用户！";
		}else{
			echo $user['password'];
			if($user['password']==$passWord){
				header('Location:home_page.php');
			}
		}
	}
}

?>
<html>
	<head>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
	
	<script src="js/jquery-1.11.3.js"></script>
	<script src="js/bootstrap.js"></script>
	</head>
	<body>
		<div class="container">
			<div class="row">
				<div class="col-xs-12" style="padding-top:70px">
				<div class="col-xs-4 col-xs-offset-4">
					<div class="panel panel-primary">
						<div class="panel-heading">
							<h3 class="panel-title"><span class="glyphicon glyphicon-glass"></span>登录点餐系统</h3>
						</div>
							<div class="panel-body">
								<form method="post" class="form-horizontal">
									<div class="form-group">
										<label for="userName" class="col-xs-3 control-label">登录名:</label>
											<div class="col-xs-9">
											<input type="text" class="form-control" id="userName" placeholder="userName" name="userName">
											</div>
									</div>
									<div class="form-group">
										<label for="pwd" class="col-xs-3 control-label">密码:</label>
											<div class="col-xs-9">
											<input type="password" class="form-control" id="pwd" placeholder="Password" name="passWord">
											</div>
									</div>
									<div class="form-group">
										<div class="col-sm-offset-3 col-xs-5">
											<button type="submit" class="btn btn-primary">登录</button>
										</div>
									</div>
								</form>
							</div>
					</div>
				</div>
				</div>
			</div>
		</div>
	</body>
</html>

